import request from '@/utils/request'

export function uploadImage(data: { file: File }) {
  return request({
    url: '/files/attac_upload',
    method: 'post',
    data,
  })
}

export function getImageList(params: {
  pid?: number
  limit?: number
  page?: number
}) {
  return request<ImageListType>({
    url: '/file/file',
    method: 'get',
    params,
  })
}

// 0编辑器,1产品图片,2拼团图片,3砍价图片,4秒杀图片,5文章图片,6组合数据图
export function getImageTypeList() {
  return Promise.resolve([
    {
      value: 0,
      label: '编辑器',
    },
    {
      value: 1,
      label: '产品图片',
    },
    {
      value: 2,
      label: '拼团图片',
    },
    {
      value: 3,
      label: '砍价图片',
    },
    {
      value: 4,
      label: '秒杀图片',
    },
    {
      value: 5,
      label: '文章图片',
    },
    {
      value: 6,
      label: '组合数据图',
    },
  ])
}
